<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增监督类型')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-paeaAuType-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">代码：</label>
                <div class="col-sm-8">
                    <input id="code" name="code" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input name="name" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">描述：</label>
                <div class="col-sm-8">
                    <textarea type="text" name="description" class="form-control" placeholder="请输入文本"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_para_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">监督预警类型：</label>
                <div class="col-sm-8">
                    <select name="type" class="form-control m-b" th:with="type=${@dict.getType('paea_au_type_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">模式：</label>
                <div class="col-sm-8">
                    <select name="sendMode" class="form-control m-b" th:with="type=${@dict.getType('paea_au_type_send_mode')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">下发方式：</label>
                <div class="col-sm-8">
                    <select name="beBatch" class="form-control m-b" th:with="type=${@dict.getType('paea_au_type_be_batch')}">
                        <option value="">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">预警状态1：</label>
                <div class="col-sm-8">
                    <select name="riskStatus" class="form-control m-b" th:with="type=${@dict.getType('paea_au_type_risk_status')}">
                        <option value="">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "oms/paeaAuType"
        $("#form-paeaAuType-add").validate({
            onkeyup: false,
            rules:{
                code:{
                    maxlength: 3,
                    remote: {
                        url: prefix + "/checkCodeUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                            "code" : function() {
                                return $.common.trim($("#code").val());
                            }
                        },
                        dataFilter: function(data, type) {
                            return $.validate.unique(data);
                        }
                    }
                }
            },
            messages: {
                "code": {
                    remote: "监督类型代码已经存在"
                }
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-paeaAuType-add').serialize());
            }
        }
    </script>
</body>
</html>